package main

import (
	"chatgpt/core"
	"chatgpt/utils"
	"net/http"
)

// main
func main() {
	http.HandleFunc("/", core.Handler)
	addressArr := utils.GetListenAddress()
	if addressArr[0] == "https" {
		certFile := utils.GetConfig("init", "cert_file", "")
		keyFile := utils.GetConfig("init", "key_file", "")
		http.ListenAndServeTLS(addressArr[1], certFile, keyFile, nil)
	} else {
		http.ListenAndServe(addressArr[1], nil)
	}
}
